// Copyright (C) Microsoft Corporation. All rights reserved.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;

namespace Microsoft.DDSolutions.UI
{
    public class GradientToolStrip : ToolStrip
    {
        // initialized to default values.
        private Color startGradient=Color.White;
        private Color endGradient = Color.FromArgb(61, 128, 223);

        protected override void OnPaintBackground(PaintEventArgs pevent)
        {
            base.OnPaint(pevent);
            Rectangle rc = new Rectangle(0, 0, this.Width, this.Height);
            LinearGradientBrush br = new LinearGradientBrush(rc, startGradient,endGradient, LinearGradientMode.Vertical);

            pevent.Graphics.FillRectangle(br, rc);
        }

        [Category("Appearance")]
        public Color StartGradientColor
        {
            set
            {
                startGradient = value;
            }
            get
            {
                return startGradient;
            }
        }

        [Category("Appearance")]
        public Color EndGradientColor
        {
            set
            {
                endGradient = value;
            }
            get
            {
                return endGradient;
            }
        }
    }
}
